package baiqitun.stupro.project.core.news.service.impl;

import baiqitun.stupro.common.service.support.MongoDataService;
import baiqitun.stupro.project.core.news.SysProjectNews;
import baiqitun.stupro.project.core.news.constant.SysProjectNewsActionEnum;
import baiqitun.stupro.project.core.news.service.SysProjectNewsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目动态的操作
 * @author kedaji
 */
@Service
public class SysProjectNewsServiceImpl extends MongoDataService<SysProjectNews> implements SysProjectNewsService{

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void saveCreateTypeNews(SysProjectNews news) {
        news.setObjectType(SysProjectNewsActionEnum.CREATE.name());
        save(news);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void saveUpdateTypeNews(SysProjectNews news) {
        news.setObjectType(SysProjectNewsActionEnum.UPDATE.name());
        save(news);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void saveDeleteTypeNews(SysProjectNews news) {
        news.setObjectType(SysProjectNewsActionEnum.DELETE.name());
        save(news);
    }
}